function get_company_list(){
  $.ajax({
    url: '/company_list',
    type: 'get',
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_company_unchecked_list(){
  $.ajax({
    url: '/company_unchecked_list',
    type: 'get',
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_company_single_info(com_name){
  var company_info = {
    name : com_name
  }
  $.ajax({
    url: '/company_single_info',
    type: 'get',
    data: company_info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function post_company_check(com_name){
  var company_info = {
    name : com_name
  }
  $.ajax({
    url: '/company_check',
    type: 'post',
    data: company_info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_regcode_list(){
  $.ajax({
    url: '/company_regcode_list',
    type: 'get',
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function post_aftermarket_add(name, phone, number, email){
  var af_info = {
    name : name,
    phone : phone,
    number : number,
    email : email
  }
  $.ajax({
    url: '/aftermarket_add',
    type: 'post',
    data: af_info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_aftermarket_list(){
  $.ajax({
    url: '/aftermarket_list',
    type: 'get',
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_af_pic(name){
  var af_info = {
    name : name
  };
  $.ajax({
    url: '/aftermarket_pic',
    type: 'get',
    data: af_info,
    success: function(data,status){
      // data.logo_str
      // data.license_str
      if(status == 'success'){
        console.log(data);
        return data;
      }
    },
    error: function(data,err,text){
      console.log(data.responseText);
    }
  });
}

function post_af_pic(name, logo_str){
  var af_pic = {
    name : name,
    logo_str : logo_str
  };
  $.ajax({
    url: '/aftermarket_pic',
    type: 'post',
    data: af_pic,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_plane_list(){
  $.ajax({
    url: '/plane_list',
    type: 'get',
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function post_plane_add(uavnumber, type, factory_time, flight_location, aftermarket_name){
  var plane_info = {
    uavnumber : uavnumber,
    type : type,
    factory_time : factory_time,
    flight_location : flight_location,
    aftermarket_name : aftermarket_name
  }
  $.ajax({
    url: '/plane_add',
    type: 'post',
    data: plane_info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function post_company_plane_add(company_name, uavnumber){
  var add_info = {
    company_name: company_name,
    uavnumber : uavnumber
  }
  $.ajax({
    url: '/company_plane_add',
    type: 'post',
    data: add_info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}

function get_company_plane_list(company_name){
  var _info = {
    name: company_name
  }
  $.ajax({
    url: '/company_plane_list',
    type: 'get',
    data: _info,
    success: function(data,status){
      if(status == 'success'){
        console.log(data);
      }
    },
    error: function(data,err){
      console.log(data);
    }
  });
}
